#!/usr/bin/env node

const http = require('http'),
      url = require('url'),
      qs = require('querystring');

http.createServer((req,res)=>{
  const addr = url.parse(req.url);
  console.log(addr.pathname);
if(addr.pathname === '/add'){

const arg = qs.parse(addr.query);
const r = {};
r.add = Number(arg.x)+Number(arg.y);
res.end(JSON.stringify(r));
}

}).listen(8080);

